import { Tools } from 'weaver-mobile';
import DocConstant from '../util/index';

const catchApiError = DocConstant.catchApiError;
// 获得文档信息
export const getDocInfo = params => {
  let locationParams = DocConstant.getLocationParams();
  return Tools.callApi({url: '/api/doc/mobile/systemDoc/getDocDetail', method: 'GET', params: {...locationParams, ...params}}).then(catchApiError);
}
export const praiseDoc = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/praiseDoc', method: 'POST', params}).then(catchApiError);
export const collectDoc = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/coluteDoc', method: 'POST', params}).then(catchApiError);
export const replyDoc = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/replyDoc', method: 'GET', params}).then(catchApiError);
export const getReply = params => Tools.callApi({url: '/api/doc/mobile/systemDoc/getReply', method: 'GET', params}).then(catchApiError);
//获取点赞的用户列表
export const getPraiseUser = params =>
    Tools.callApi({url: '/api/doc/mobile/systemDoc/getPraiseObjList', method: 'GET', params}).then(catchApiError);

export const deleteReply = params => Tools.callApi({url: '/api/doc/mobile/systemDoc/deleteReply', method: 'GET', params}).then(catchApiError);
//调用附件转换
export const convertFile = params => Tools.callApi({url: '/api/doc/acc/convertFileForMobile', method: 'GET', params}).then();
// export const attachDownload = params => Tools.callApi({url: '/weaver/weaver.file.FileDownload', method: 'GET', params}).then();
//获取日志的tab信息
export const getLogTabInfo = params => Tools.callApi({url: '/api/doc/log/tabInfo', method: 'GET', params}).then();
//获取日志信息
export const getLogList = params => Tools.callApi({url: '/api/doc/log/list', method: 'GET', params}).then();
    
//柳州下载接口
export const downloadfile = params => Tools.callApi({url:`/weaver/weaver.file.FileDownload`,method: 'GET',params})
//根据附件id来判断当前附件是不是图片
export const isPicture = params => Tools.callApi({url: '/api/doc/mobile/systemDoc/ispicture', method: 'GET', params}).then();
//提交草稿状态的文档
export const dosubmit = (params) =>
  Tools.callApi({url: '/api/doc/mobile/systemDoc/submit', method: 'POST', params}).then(catchApiError);

  //获取下载链接后边跟的参数（处理ios下载问题）
export const getDownloadParams = params => Tools.callApi({url: '/api/doc/mobile/imagefile/getMobileDownloadParams', method: 'GET', params}).then();

//获取wps签名
export const getWpsSign = params => Tools.callApi({url: '/api/doc/acc/getWpsSign', method: 'GET', params}).then();

//设置提醒状态
export const updateBizStateForDoc = params => Tools.callApi({url: '/api/doc/detail/updateBizStateForDoc', method: 'POST', params}).then();

//删除文档
export const deleteDoc = params => Tools.callApi({url: '/api/doc/operate/delete', method: 'GET', params}).then();

export const deleteWarm = params => Tools.callApi({url: '/api/doc/operate/deleteWarm', method: 'GET', params}).then();




